package net.suncaper.demo.service;

import net.suncaper.demo.domain.*;
import net.suncaper.demo.mapper.ArrangementMapper;
import net.suncaper.demo.mapper.ReplyMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

@Service
public class ReplyServiceImpl implements ReplyService {
    @Autowired
    private ReplyMapper replyMapper;
    @Autowired
    private ArrangementMapper arrangementMapper;
    @Override
    public List<Reply> findReply() {
        return replyMapper.selectByExample(new ReplyExample());
    }

    @Override
    public void saveReply(Reply reply) {
        replyMapper.insert(reply);
    }

    @Override
    public Reply findReplyById(BigDecimal id) {
        return replyMapper.selectByPrimaryKey(id);
    }

    @Override
    public void deleteArrangementById(BigDecimal id) {
        arrangementMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void updateArrangement(Arrangement arrangement) {
       arrangementMapper.updateByPrimaryKeySelective(arrangement);
    }

    @Override
    public List<Arrangement> findArrangement() {
        return arrangementMapper.selectByExample(new ArrangementExample());
    }

    @Override
    public void saveArrangement(Arrangement arrangement) {
         arrangementMapper.insert(arrangement);
    }

    @Override
    public Arrangement findArrangementId(BigDecimal id) {
        return arrangementMapper.selectByPrimaryKey(id);
    }
}
